//logs.js
const app = getApp()
const Utils = require("../../utils/util.js");

Page({
  data: {
    isLogin: false, //是否登录
    userImg:'',
    username:''
  },
  onLoad: function () {
    
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
    let userId = wx.getStorageSync('userId')
    console.log(userId)
    let that = this
    if (userId) {
      this.setData({
        isLogin: true
      })
      Utils.getDataRequest('?s=App.Merchant_User.GetInfo', {
        enterprise_basic_info_id: userId
      }, function success(res) {
        console.log(res)
        that.setData({
          userImg:res.data.data.user_img,
          username:res.data.data.name
        })
        //成功回调
      }, function fail(res) {
        //失败回调
      }, 'hotel')
    }
  },
  navlogin(){
    wx.navigateTo({
      url: '../login/login',
    })
  },
  tuichu(){
    wx.clearStorageSync();
    this.setData({
      isLogin: false
    })
    wx.navigateTo({
      url:'../wode/wode'
    })
  }
})
